#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int MAXN = 2e5 + 10;
const int MOD = 1e9 + 7;


int n, q, a[MAXN];

struct node {
    int l, r;
    ll lazy;
    ll sum;
} tr[MAXN << 2];

inline int lson(int x) {
    return x << 1;
}
inline int rson(int x) {
    return x << 1 | 1;
}

void pushup(int x) {
    tr[x].sum = tr[lson(x)].sum + tr[rson(x)].sum;
}

void pushdown(int x) {
    if (tr[x].lazy) {
        tr[lson(x)].lazy = tr[x].lazy;
        tr[rson(x)].lazy = tr[x].lazy;
        tr[lson(x)].sum = (tr[lson(x)].r - tr[lson(x)].l + 1) * tr[x].lazy;
        tr[rson(x)].sum = (tr[rson(x)].r - tr[rson(x)].l + 1) * tr[x].lazy;
        tr[x].lazy = 0;
    }
}

void build(int x, int l, int r) {
    tr[x].l = l, tr[x].r = r, tr[x].lazy = 0;
    if (l == r) {
        return;
    }

    int mid = l + r >> 1;
    build(lson(x), l, mid);
    build(rson(x), mid + 1, r);
    pushup(x);
}

ll query(int x, int l, int r) {
    if (tr[x].l >= l && tr[x].r <= r)
        return tr[x].sum;

    if (tr[x].l > r || tr[x].r < l)
        return 0;

    pushdown(x);
    return query(lson(x), l, r) + query(rson(x), l, r);
}

void update(int x, int l, int r, ll k) {
    if (tr[x].l >= l && tr[x].r <= r) {
        tr[x].lazy = k;
        tr[x].sum = (tr[x].r - tr[x].l + 1) * k;
        return;
    }

    if (tr[x].l > r || tr[x].r < l)
        return;

    pushdown(x);
    update(lson(x), l, r, k);
    update(rson(x), l, r, k);
    pushup(x);
}


int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> n >> q;
    build(1, 1, n);

    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        update(1, i, i, a);
    }

    while (q--) {
        int t, x, i;
        cin >> t;
        if (t == 1) {
            cin >> i >> x;
            update(1, i, i, x);
        }
        else {
            cin >> x;
            update(1, 1, n, x);
        }
        cout << query(1, 1, n) << endl;
    }
    return 0;
}